<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>event</title>
  <script src="/vue.js"></script>
</head>
<body>

  <div id="root">
    <!-- {{title}} -->
    <!-- <button @click.once="handleClick($event, 0)">click</button> -->
    <div @click="handleClick">
      <div style="width: 100px; height: 100px; background: yellowgreen;"
        @click.self="handleClick"
      >
        parent
        <div
          @click="handleClick"
        style="width: 50px; height: 50px; background:red;">
          child
        </div>
      </div>
    </div>
  </div>

  <!-- <div>
    <button id="btn">click</button>
  </div>

  <script>
    function handleClick(args) {
      // 函数柯里化
      return (e) => {
        console.log(args)
      }
    }
    document.querySelector('#btn').addEventListener('click', handleClick(0), {
      capture: false,
    })
  </script> -->

  <script>
    var vm = new Vue({
      el: '#root',
      data: {
        title: 'hello'
      },
      methods: {
        handleRootClick() {
          console.log('root clicked.')
        }
      },

      created() {
        this.handleClick = this.$options.handleClick
      },

      handleClick(e, num) {
        // e.stopPropagation();
        console.log(0)
        
      }
    })
  </script>


</body>
</html>